using System;
using System.Collections.Generic;
using System.Text;
using System.ServiceModel;
using DevExpress.Xpo.DB;
using System.Reflection;
using System.ComponentModel;
using DevExpress.Data.Filtering;
using DevExpress.Xpo.DB.Helpers;

namespace Common 
{
	[ServiceContract]
	public interface ICachedDataStoreContract 
    {
        [OperationContract]
        [ServiceKnownType(typeof(DataCacheModificationResult))]
        [ServiceKnownType(typeof(DataCacheSelectDataResult))]
        [ServiceKnownType(typeof(DataCacheUpdateSchemaResult))]
        DataCacheResult NotifyDirtyTables(DataCacheCookie cookie, params string[] dirtyTablesNames);

        [OperationContract]
        [ServiceKnownType(typeof(DataCacheModificationResult))]
        [ServiceKnownType(typeof(DataCacheSelectDataResult))]
        [ServiceKnownType(typeof(DataCacheUpdateSchemaResult))]
        DataCacheResult ProcessCookie(DataCacheCookie cookie);

        [OperationContract]
        AutoCreateOption GetAutoCreateOption();

        [OperationContract]
        [ServiceKnownType(typeof(InsertStatement))]
        [ServiceKnownType(typeof(DeleteStatement))]
        [ServiceKnownType(typeof(UpdateStatement))]
        [ServiceKnownType(typeof(ContainsOperator))]
        [ServiceKnownType(typeof(BetweenOperator))]
        [ServiceKnownType(typeof(BinaryOperator))]
        [ServiceKnownType(typeof(UnaryOperator))]
        [ServiceKnownType(typeof(InOperator))]
        [ServiceKnownType(typeof(GroupOperator))]
        [ServiceKnownType(typeof(OperandValue))]
        [ServiceKnownType(typeof(ParameterValue))]
        [ServiceKnownType(typeof(OperandProperty))]
        [ServiceKnownType(typeof(AggregateOperand))]
        [ServiceKnownType(typeof(FunctionOperator))]
        [ServiceKnownType(typeof(NotOperator))]
        [ServiceKnownType(typeof(NullOperator))]
        [ServiceKnownType(typeof(QueryOperand))]
        [ServiceKnownType(typeof(QuerySubQueryContainer))]
        DataCacheModificationResult ModifyDataCached(DataCacheCookie cookie, ModificationStatement[] dmlStatements);
        
        [OperationContract]
        [ServiceKnownType(typeof(ContainsOperator))]
        [ServiceKnownType(typeof(BetweenOperator))]
        [ServiceKnownType(typeof(BinaryOperator))]
        [ServiceKnownType(typeof(UnaryOperator))]
        [ServiceKnownType(typeof(InOperator))]
        [ServiceKnownType(typeof(GroupOperator))]
        [ServiceKnownType(typeof(OperandValue))]
        [ServiceKnownType(typeof(ParameterValue))]
        [ServiceKnownType(typeof(OperandProperty))]
        [ServiceKnownType(typeof(AggregateOperand))]
        [ServiceKnownType(typeof(FunctionOperator))]
        [ServiceKnownType(typeof(NotOperator))]
        [ServiceKnownType(typeof(NullOperator))]
        [ServiceKnownType(typeof(QueryOperand))]
        [ServiceKnownType(typeof(QuerySubQueryContainer))]
        DataCacheSelectDataResult SelectDataCached(DataCacheCookie cookie, SelectStatement[] selects);

        [OperationContract]
        [ServiceKnownType(typeof(DBColumn))]
        [ServiceKnownType(typeof(DBIndex))]
        [ServiceKnownType(typeof(DBPrimaryKey))]
        DataCacheUpdateSchemaResult UpdateSchemaCached(DataCacheCookie cookie, DBTable[] tables, bool dontCreateIfFirstTableNotExist);


        [OperationContract]
        [ServiceKnownType(typeof(InsertStatement))]
        [ServiceKnownType(typeof(DeleteStatement))]
        [ServiceKnownType(typeof(UpdateStatement))]
        [ServiceKnownType(typeof(ContainsOperator))]
        [ServiceKnownType(typeof(BetweenOperator))]
        [ServiceKnownType(typeof(BinaryOperator))]
        [ServiceKnownType(typeof(UnaryOperator))]
        [ServiceKnownType(typeof(InOperator))]
        [ServiceKnownType(typeof(GroupOperator))]
        [ServiceKnownType(typeof(OperandValue))]
        [ServiceKnownType(typeof(ParameterValue))]
        [ServiceKnownType(typeof(OperandProperty))]
        [ServiceKnownType(typeof(AggregateOperand))]
        [ServiceKnownType(typeof(FunctionOperator))]
        [ServiceKnownType(typeof(NotOperator))]
        [ServiceKnownType(typeof(NullOperator))]
        [ServiceKnownType(typeof(QueryOperand))]
        [ServiceKnownType(typeof(QuerySubQueryContainer))]
        ModificationResult ModifyData(params ModificationStatement[] dmlStatements);

        [OperationContract]
        [ServiceKnownType(typeof(ContainsOperator))]
        [ServiceKnownType(typeof(BetweenOperator))]
        [ServiceKnownType(typeof(BinaryOperator))]
        [ServiceKnownType(typeof(UnaryOperator))]
        [ServiceKnownType(typeof(InOperator))]
        [ServiceKnownType(typeof(GroupOperator))]
        [ServiceKnownType(typeof(OperandValue))]
        [ServiceKnownType(typeof(ParameterValue))]
        [ServiceKnownType(typeof(OperandProperty))]
        [ServiceKnownType(typeof(AggregateOperand))]
        [ServiceKnownType(typeof(FunctionOperator))]
        [ServiceKnownType(typeof(NotOperator))]
        [ServiceKnownType(typeof(NullOperator))]
        [ServiceKnownType(typeof(QueryOperand))]
        [ServiceKnownType(typeof(QuerySubQueryContainer))]
        SelectedData SelectData(params SelectStatement[] selects);

        [OperationContract]
        [ServiceKnownType(typeof(DBColumn))]
        [ServiceKnownType(typeof(DBIndex))]
        [ServiceKnownType(typeof(DBPrimaryKey))]
        UpdateSchemaResult UpdateSchema(bool dontCreateIfFirstTableNotExist, params DBTable[] tables);
    }
}
